#include<iostream>
#include<stack>
#include<map>
using namespace std;
stack<char>s1,s2;
map<char,int>op;
string str;
int n;
void init()
{
	op['+']=op['-']=1;
	op['*']=op['/']=2;
}
int main()
{
	cin>>str;
	n=str.size();
	init();
	for(int i=0;i<n;i++)
	{
		if(isdigit(str[i])||((str[i]=='-')&&i==0)||(str[i]=='-'&&!isdigit(str[i-1])))
		{
			while((isdigit(str[i])||str[i]=='.'||(str[i]=='-'&&!i)||(str[i]=='-'&&!isdigit(str[i-1])))&&i<n)
		    {
               if(str[i]!='+')
			   s2.push(str[i]);
			   i++;
		    }
		    i=i-1; 
		    s2.push(' ');
		}
		else if(str[i]=='(')
		s1.push(str[i]);
		else if(str[i]==')')
		{
//			cout<<s1.top()<<endl; 
			while(s1.top()!='(')
			{
//				cout<<s1.size()<<endl; 
				s2.push(s1.top());
				s2.push(' ');
				s1.pop();
			}
		    s1.pop(); 
		}
		else
		{
			while(!s1.empty()&&op[s1.top()]>=op[str[i]]) 
			{
				s2.push(s1.top());
				s2.push(' ');
			    s1.pop();
			}
//			cout<<str[i]<<endl; 
			s1.push(str[i]);
//			cout<<s1.size(); 
		}
	}
	while(s1.size()) 
	{
		s2.push(s1.top());
		s2.push(' ');
		s1.pop();
	}
	string ans; 
	while(!s2.empty())
	{
		ans=ans+s2.top();
		s2.pop();
	}
	for(int i=ans.size()-1;i>0;i--)
	cout<<ans[i];
    return 0;	
} 
